// 初始化查询表单设计器自定义弹窗下拉组件列表数据
export function initCustomOpation() {
  try {
    setTimeout(() => {
      window.removeEventListener('message', () => {})
      window.addEventListener('message', onMessage, false)
      function onMessage(data) {
        if (data.data.type === 'showQueryDesign') {
          let iframe = document.getElementById('iframe')
          // 获取iframe的window对象
          const iWindow = iframe.contentWindow
          iWindow[0].postMessage(
            {
              type: 'registerDialogCustom',
              data: [
                {
                  value: 'select-user',
                  label: '选择用户',
                },
                {
                  value: 'select-supplier',
                  label: '选择供应商',
                },
                {
                  value: 'select-product',
                  label: '选择产品',
                },
                {
                  value: 'select-dept',
                  label: '选择部门',
                },
                {
                  value: 'select-device-type',
                  label: '选择医疗器械分类目录',
                },
                {
                  value: 'select-finance-type',
                  label: '选择财务分类',
                },
                {
                  value: 'select-asset-classify-type',
                  label: '选择资产分类',
                },
                {
                  value: 'select-fiscal-period',
                  label: '选择会计期间',
                },
                {
                  value: 'select-patrol-route',
                  label: '选择巡检路线',
                },
                {
                  value: 'select-maintenance',
                  label: '选择维保商',
                },
                {
                  value: 'select-repair-user',
                  label: '选择维修人员',
                },
                {
                  value: 'select-maintenance-user',
                  label: '选择维修组维修人员',
                },
                {
                  value: 'select-shelf-no',
                  label: '选择货位',
                },
              ],
            },
            import.meta.env.VITE_APP_UREPORT_URL
          )
        }
      }
    }, 0)
  } catch (error) {}
}
